package fr.ifsic.film.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

import fr.ifsic.film.client.ui.Accueil;
import fr.ifsic.film.client.ui.DetailsActeur;
import fr.ifsic.film.client.ui.DetailsFilm;
import fr.ifsic.film.client.ui.DetailsPersonne;
import fr.ifsic.film.client.ui.DetailsVedette;
import fr.ifsic.film.client.ui.ListeActeurs;
import fr.ifsic.film.client.ui.ListeFilms;
import fr.ifsic.film.client.ui.ListePersonnes;
import fr.ifsic.film.client.ui.ListeVedettes;
import fr.ifsic.film.client.ui.NouvelActeur;
import fr.ifsic.film.client.ui.NouveauFilm;
import fr.ifsic.film.client.ui.NouvellePersonne;
import fr.ifsic.film.client.ui.NouvelleVedette;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class FilmProject implements EntryPoint {

	/**
	 * Create a remote service proxy to talk to the server-side Greeting
	 * service.
	 */
	public static final ProjetDopAsync greetingService = GWT
			.create(ProjetDop.class);

	/**
	 * This is the entry point method.
	 */
	public static VerticalPanel currentPage;
	public static VerticalPanel accueil = new Accueil();
	public static VerticalPanel lp = new ListePersonnes();
	public static VerticalPanel la = new ListeActeurs();
	public static VerticalPanel lf = new ListeFilms();
	public static VerticalPanel lv = new ListeVedettes();

	public static VerticalPanel dp = new DetailsPersonne();
	public static VerticalPanel da = new DetailsActeur();
	public static VerticalPanel df = new DetailsFilm();
	public static VerticalPanel dv = new DetailsVedette();

	public static VerticalPanel np = new NouvellePersonne();
	public static VerticalPanel na = new NouvelActeur();
	public static VerticalPanel nf = new NouveauFilm();
	public static VerticalPanel nv = new NouvelleVedette();

	public static void changePage(VerticalPanel next) {
		currentPage.setVisible(false);
		currentPage = next;
		currentPage.setVisible(true);
	}

	public void onModuleLoad() {
		currentPage = accueil;
		RootPanel.get("accueil").add(accueil);
		RootPanel.get("lp").add(lp);
		RootPanel.get("la").add(la);
		RootPanel.get("lf").add(lf);
		RootPanel.get("lv").add(lv);
		RootPanel.get("dp").add(dp);
		RootPanel.get("da").add(da);
		RootPanel.get("df").add(df);
		RootPanel.get("dv").add(dv);
		RootPanel.get("np").add(np);
		RootPanel.get("na").add(na);
		RootPanel.get("nf").add(nf);
		RootPanel.get("nv").add(nv);

		lp.setVisible(false);
		la.setVisible(false);
		lf.setVisible(false);
		lv.setVisible(false);

		dp.setVisible(false);
		da.setVisible(false);
		df.setVisible(false);
		dv.setVisible(false);

		np.setVisible(false);
		na.setVisible(false);
		nf.setVisible(false);
		nv.setVisible(false);
	}
}
